package com.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.common.utils.DateUtils;
import com.common.utils.base.UuidUtil;
import com.entity.News;
import com.repository.NewsDao;
import com.service.base.BaseServiceImp;

@Service("NewsService")
public class NewsServiceImpl extends BaseServiceImp<News> implements NewsService{
	
	@Autowired
	private NewsDao newsDao;

	@Override
	public String insert(News o) {
		o.setId(UuidUtil.get32UUID());
		o.setViewCount(0);
		o.setLikedCount(0);
		o.setReviewCount(0);
		o.setPublishTime(DateUtils.getDate("yyyy/MM/dd HH:mm:ss"));
		baseDao.insert(o);
		return o.getId();
	}

	@Override
	public List<News> findNews(int size) {
		return newsDao.findNews(size);
	}
	
	
}
